<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <title><%= title %></title>
  <link rel="stylesheet" type="text/css" href="/layui/css/layui.css">
  <link rel="stylesheet" type="text/css" href="/so/css/main.css">
  <!--加载meta IE兼容文件-->
  <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
  <![endif]-->  
</head>

<body>
  <div class="header">
    <h1 class="logo">
      <a href="index.html">
        <span>MY SO</span>
        <!-- <img src="http://www.epaynfc.com/wp-content/themes/winnerNew/images/logo-Icon.png" > -->
        <strong style="width:237px;height:34px;background:#ccc;color:blueviolet">LOGO</strong>
      </a>
    </h1>
    
  </div>
  <div class="search-box">
    <div class="searchbar">
      <img src=/so/img/search.png class="mg">
      <input type="text" id="search" value="" name="keyword">
      <img src=/so/img/googlemic_color_24dp.png class="mcp" id="search-click">
    </div>
  </div>
  <div class="content">
    <div class="cont w1000">
      <div class="title">
        <span class="layui-breadcrumb" lay-separator="|">
          <a href="javascript:;"<%if (!category) {%> class="active"<%}%>>全部标签,共（<%=total%>）个</a>
        </span>
      </div>
      <div class="list-item" data-list-total="<%=total%>">
          <%
          if(typeof(data) != 'undefined' && data.length > 0){%>
          <%data.forEach(function(value){%>
            <button type="button" class="layui-btn layui-btn-primary" data-key="<%=value.key%>"><%=value.wd%></button>
          <%})%>
          <%} else {%>
          <div class="item">
            <div class="layui-fluid">
              <div class="layui-row">
                <div class="layui-col-xs12 layui-col-sm8 layui-col-md7">没有数据……</div>
              </div>
            </div>
          </div>
          <%}%>

      </div>
    </div>
  </div>

  <script type="text/javascript" src="/layui/layui.js"></script>
  <script type="text/javascript">
    layui.config({
      base: '/so/js/util/'
    }).use(['element', 'laypage', 'jquery', 'menu'], function () {
      element = layui.element, laypage = layui.laypage, $ = layui.$;

      function search() {
        let word = $('#search').val();
        if (!word || word == '') return ;
        window.location.href = '/so?word=' + word;
      }
      $('#search-click').click(function () {
      
        search();
      });

      
      $('#search').bind('keypress', function (event) {
        if (event.keyCode == "13") {
          $("#search-click").click();
        }
      });

      $('.layui-btn').click(function () {
           
          let _key = $(this).data('key');
          let wd = $(this).text();
          window.location.href = '/so/list?key='+_key+'&word='+wd;
      });
      
    });
  </script>
</body>
</html>